package geovista.matrix.map;

import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;

/**
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright: Copyright (c) 2002
 * </p>
 * <p>
 * Company:
 * </p>
 * 
 * @author unascribed
 *  This library is free software; you can redistribute it and/or
 *          modify it under the terms of the GNU Lesser General Public License
 *          as published by the Free Software Foundation; either version 2.1 of
 *          the License, or (at your option) any later version. This library is
 *          distributed in the hope that it will be useful, but WITHOUT ANY
 *          WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *          FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 *          License for more details. You should have received a copy of the GNU
 *          Lesser General Public License along with this library; if not, write
 *          to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 *          Boston, MA 02111-1307 USA
 *          -------------------------------------------------------------------
 */

public class MapMatrixElementBeanInfo extends SimpleBeanInfo {
	static Class beanClass = MapMatrixElement.class;
	static String iconColor16x16Filename = "resources/mapCanMatrixSmall.gif";
	static String iconColor32x32Filename = "resources/mapCanMatrix.gif";
	static String iconMono16x16Filename;
	static String iconMono32x32Filename;

	public MapMatrixElementBeanInfo() {
	}

	@Override
	public PropertyDescriptor[] getPropertyDescriptors() {
		PropertyDescriptor[] pds = new PropertyDescriptor[] {};
		return pds;
	}

	@Override
	public java.awt.Image getIcon(int iconKind) {
		switch (iconKind) {
		case BeanInfo.ICON_COLOR_16x16:
			return iconColor16x16Filename != null
					? loadImage(iconColor16x16Filename) : null;
		case BeanInfo.ICON_COLOR_32x32:
			return iconColor32x32Filename != null
					? loadImage(iconColor32x32Filename) : null;
		case BeanInfo.ICON_MONO_16x16:
			return iconMono16x16Filename != null
					? loadImage(iconMono16x16Filename) : null;
		case BeanInfo.ICON_MONO_32x32:
			return iconMono32x32Filename != null
					? loadImage(iconMono32x32Filename) : null;
		}
		return null;
	}

	@Override
	public BeanDescriptor getBeanDescriptor() {
		BeanDescriptor bd = new BeanDescriptor(beanClass);
		bd.setPreferred(true);
		bd.setShortDescription("A map for putting in a matrix.");
		bd.setValue("hidden-state", Boolean.TRUE);
		bd
				.setValue("helpSetName",
						"edu/psu/geovista/app/map/resources/MapMatrixElementHelp/jhelpset.hs");
		return bd;
	}

	@Override
	public BeanInfo[] getAdditionalBeanInfo() {
		Class superclass = beanClass.getSuperclass();
		try {
			BeanInfo superBeanInfo = Introspector.getBeanInfo(superclass);
			return new BeanInfo[] { superBeanInfo };
		} catch (IntrospectionException ex) {
			ex.printStackTrace();
			return null;
		}
	}
}